package com.myjar.excel.v2;

import com.myjar.excel.serializer.ObjectSerializer;
import com.myjar.excel.serializer.SerializerConfig;
import org.apache.poi.ss.usermodel.Cell;

public class POiCell implements _Cell {

    private Cell cell;

    public POiCell(Cell cell) {
        this.cell = cell;
    }

    @Override
    public <T> T getVal(ObjectSerializer<T> objectSerializer) throws Exception {
        return objectSerializer.read(cell);
    }

    @Override
    public <T> void setVal(T t, ObjectSerializer<T> objectSerializer) throws Exception {
        objectSerializer.write(cell, t);
    }

    @Override
    public boolean isNull() {
        return cell == null;
    }
}
